package main

import (
	"strconv"
	"time"
	"fmt"
)

func sample(ch chan string){
	for i:=0;i<19;i++{
		ch <- " i m sample num:"+strconv.Itoa(i)
		time.Sleep(1*time.Second)
	}


}

func sample2(ch chan int){
	for i:=0;i<5;i++{
		ch<-i
		time.Sleep(3*time.Second)
	}
}

func main() {
	var ch1=make(chan string,3)
	var ch2=make(chan int,5)

	for i:=0;i<10;i++{
		go sample(ch1)
		go sample2(ch2)
	}

	select {
	case c1,c1_check:=<-ch1:
		if !c1_check{
			fmt.Println("ch1 failed!")
		}
		fmt.Println(c1)
	case c2,c2_check:=<-ch2:
		if !c2_check{
			fmt.Println("ch2 failed!")
		}
		fmt.Println(c2)
	}
}
